import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { GroupDto } from 'src/app/models/sys/group.dto';
import { ApiService } from 'src/app/services/api.service';

@Component({
  selector: 'app-group-detail',
  templateUrl: './group-detail.component.html',
  styleUrl: './group-detail.component.less'
})
export class GroupDetailComponent implements OnInit {
  @Input() groupSubject = new BehaviorSubject<GroupDto>(new GroupDto());
  @Output() detailEvent = new EventEmitter<boolean>();

  group?: GroupDto;

  constructor(private _api: ApiService) {

  }

  ngOnInit(): void {
    this.groupSubject.subscribe((value) => {
      this.group = value;
    });
  }

  onClose(event: UIEvent) {
    event.preventDefault();

    this.detailEvent.emit(true);
  }
}
